﻿using Little.Soldier.SWIFT;
using Little.Soldier.SWIFT.Definition;
using System.Collections.Generic;
using System.ComponentModel;

namespace Little.Soldier.SWIFT.Messages.Category9
{
  public class MT935 : SwiftMessage
  {
    private static SwiftMessageDefinition MessageDefinition;
    private static SwiftTagDefinition U0002;
    private static SwiftTagSubItemDefinition U0003;
    private static SwiftTagSequenceDefinition U0004;
    private static SwiftTagDefinition U0005;
    private static SwiftTagSubItemDefinition U0006;
    private static SwiftTagSubItemDefinition U0007;
    private static SwiftTagDefinition U0008;
    private static SwiftTagSubItemDefinition U000E;
    private static SwiftTagDefinition U000F;
    private static SwiftTagSubItemDefinition U0010;
    private static SwiftTagDefinition U0011;
    private static SwiftTagSubItemDefinition U0012;
    private static SwiftTagSubItemDefinition U0013;
    private static SwiftTagDefinition U0014;

    [Description("Transaction Reference Number ")]
    public Tag20 TransactionReferenceNumber_20
    {
      get
      {
        return new Tag20((SwiftElement) this, 0, (SwiftDefinitionElement) MT935.U0002);
      }
    }

    [Description("Transaction Reference Number ")]
    public Tag20 Tag20_TransactionReferenceNumber
    {
      get
      {
        return this.TransactionReferenceNumber_20;
      }
    }

    [Description("Further Identification")]
    public MT935.SequenceClass[] Sequence
    {
      get
      {
        int index = -1;
        List<MT935.SequenceClass> list = new List<MT935.SequenceClass>();
        int count;
        do
        {
          ++index;
          MT935.SequenceClass sequenceClass = new MT935.SequenceClass((SwiftElement) this, index, false);
          count = this.ListTags((SwiftElement) sequenceClass).Count;
          if (count > 0)
            list.Add(sequenceClass);
        }
        while (count > 0);
        return list.ToArray();
      }
    }

    [Description("Sender To Receiver Information")]
    public Tag72 SenderToReceiverInformation_72
    {
      get
      {
        return new Tag72((SwiftElement) this, 0, (SwiftDefinitionElement) MT935.U0014);
      }
    }

    [Description("Sender To Receiver Information")]
    public Tag72 Tag72_SenderToReceiverInformation
    {
      get
      {
        return this.SenderToReceiverInformation_72;
      }
    }

    public MT935()
      : base(true)
    {
    }

    public MT935(SwiftMessage message)
      : base(message)
    {
    }

    public MT935.SequenceClass AddSequence()
    {
      return new MT935.SequenceClass((SwiftElement) this, this.Sequence.Length, true);
    }

    public void RemoveSequence(MT935.SequenceClass sequence)
    {
      foreach (SwiftTag tag in this.ListTags((SwiftElement) sequence))
        this.RemoveTag(tag);
    }

    internal override SwiftMessageDefinition MsgDefinition()
    {
      return MT935.MessageDefinition;
    }

    protected override void InitSwiftMessageDefinition()
    {
      MT935.MessageDefinition = new SwiftMessageDefinition("MT935", "Rate Change Advice");
      MT935.U0002 = new SwiftTagDefinition("TransactionReferenceNumber_20", "Transaction Reference Number ");
      MT935.U0002.TagName = ":20:";
      MT935.U0003 = new SwiftTagSubItemDefinition("Reference", " Reference ");
      MT935.U0002.Elements.Add((SwiftDefinitionElement) MT935.U0003);
      MT935.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT935.U0002);
      MT935.U0004 = new SwiftTagSequenceDefinition("Sequence", "Further Identification");
      MT935.U0004.Multiple = true;
      MT935.U0005 = new SwiftTagDefinition("FurtherIdentification_23", "Further Identification");
      MT935.U0005.TagName = ":23:";
      MT935.U0005.Mandatory = false;
      MT935.U0006 = new SwiftTagSubItemDefinition("Currency", "Currency");
      MT935.U0005.Elements.Add((SwiftDefinitionElement) MT935.U0006);
      MT935.U0007 = new SwiftTagSubItemDefinition("NumberOfDaysAndFunction", "Number Of Days And Function");
      MT935.U0005.Elements.Add((SwiftDefinitionElement) MT935.U0007);
      MT935.U0004.Elements.Add((SwiftDefinitionElement) MT935.U0005);
      MT935.U0008 = new SwiftTagDefinition("AccountIdentification_25", "Account Identification");
      MT935.U0008.TagName = ":25:";
      MT935.U0008.Mandatory = false;
      MT935.U000E = new SwiftTagSubItemDefinition("Account", "Account ");
      MT935.U0008.Elements.Add((SwiftDefinitionElement) MT935.U000E);
      MT935.U0004.Elements.Add((SwiftDefinitionElement) MT935.U0008);
      MT935.U000F = new SwiftTagDefinition("EffectiveDateOfNewRate_30", "Effective Date Of NewRate");
      MT935.U000F.TagName = ":30:";
      MT935.U0010 = new SwiftTagSubItemDefinition("Date", "Date");
      MT935.U000F.Elements.Add((SwiftDefinitionElement) MT935.U0010);
      MT935.U0004.Elements.Add((SwiftDefinitionElement) MT935.U000F);
      MT935.U0011 = new SwiftTagDefinition("NewInterestRate_37H", "New Interest Rate");
      MT935.U0011.TagName = ":37H:";
      MT935.U0012 = new SwiftTagSubItemDefinition("Indicator", "Indicator");
      MT935.U0011.Elements.Add((SwiftDefinitionElement) MT935.U0012);
      MT935.U0013 = new SwiftTagSubItemDefinition("Rate", "Rate");
      MT935.U0011.Elements.Add((SwiftDefinitionElement) MT935.U0013);
      MT935.U0004.Elements.Add((SwiftDefinitionElement) MT935.U0011);
      MT935.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT935.U0004);
      MT935.U0014 = new SwiftTagDefinition("SenderToReceiverInformation_72", "Sender To Receiver Information");
      MT935.U0014.TagName = ":72:";
      MT935.U0014.Mandatory = false;
      MT935.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT935.U0014);
    }

    public class SequenceClass : SwiftTagSequence
    {
      internal override SwiftDefinitionElement Definition
      {
        get
        {
          return (SwiftDefinitionElement) MT935.U0004;
        }
      }

      [Description("Further Identification")]
      public Tag23 FurtherIdentification_23
      {
        get
        {
          return new Tag23((SwiftElement) this, 0, (SwiftDefinitionElement) MT935.U0005);
        }
      }

      [Description("Further Identification")]
      public Tag23 Tag23_FurtherIdentification
      {
        get
        {
          return this.FurtherIdentification_23;
        }
      }

      [Description("Account Identification")]
      public Tag25 AccountIdentification_25
      {
        get
        {
          return new Tag25((SwiftElement) this, 0, (SwiftDefinitionElement) MT935.U0008);
        }
      }

      [Description("Account Identification")]
      public Tag25 Tag25_AccountIdentification
      {
        get
        {
          return this.AccountIdentification_25;
        }
      }

      [Description("Effective Date Of NewRate")]
      public Tag30 EffectiveDateOfNewRate_30
      {
        get
        {
          return new Tag30((SwiftElement) this, 0, (SwiftDefinitionElement) MT935.U000F);
        }
      }

      [Description("Effective Date Of NewRate")]
      public Tag30 Tag30_EffectiveDateOfNewRate
      {
        get
        {
          return this.EffectiveDateOfNewRate_30;
        }
      }

      [Description("New Interest Rate")]
      public Tag37H NewInterestRate_37H
      {
        get
        {
          return new Tag37H((SwiftElement) this, 0, (SwiftDefinitionElement) MT935.U0011);
        }
      }

      [Description("New Interest Rate")]
      public Tag37H Tag37H_NewInterestRate
      {
        get
        {
          return this.NewInterestRate_37H;
        }
      }

      internal SequenceClass(SwiftElement parent, int index, bool createTags)
        : base(parent, index, createTags)
      {
      }
    }
  }
}
